Trò chơi Angry Birds trong UNITY Engine
31.720 lượt xem;
1 using UnityEngine;
2 using System;
3 using System.Collections;
4 using System.Collections.Generic;
5
6
7 public class GoTweenConfig
8 {
9 private List<AbstractTweenProperty> _tweenProperties = new List<AbstractTweenProperty>();
10 public List<AbstractTweenProperty> tweenProperties { get { return _tweenProperties; } }
11
12 public int id; // id for finding the Tween at a later time. multiple Tweens can have the same id
13 public float delay; // how long should we delay before starting the Tween
14 public int iterations = 1; // number of times to iterate. -1 will loop indefinitely
15 public int timeScale = 1;
16 public GoLoopType loopType = Go.defaultLoopType;
17 public GoEaseType easeType = Go.defaultEaseType;
18 public bool isPaused;
19 public GoUpdateType propertyUpdateType = Go.defaultUpdateType;
20 public bool isFrom;
21
22 public Action<AbstractGoTween> onInitHandler;
23 public Action<AbstractGoTween> onBeginHandler;
24 public Action<AbstractGoTween> onIterationStartHandler;
25 public Action<AbstractGoTween> onUpdateHandler;
26 public Action<AbstractGoTween> onIterationEndHandler;
27 public Action<AbstractGoTween> onCompleteHandler;
28
29
30 #region TweenProperty adders
31
32 /// <summary>
33 /// position tween
34 /// </summary>
35 public GoTweenConfig position( Vector3 endValue, bool isRelative = false )
36 {
37 var prop = new PositionTweenProperty( endValue, isRelative );
38 _tweenProperties.Add( prop );
39
40 return this;
41 }
42
43
44 /// <summary>
45 /// localPosition tween
46 /// </summary>
47 public GoTweenConfig localPosition( Vector3 endValue, bool isRelative = false )
48 {
49 var prop = new PositionTweenProperty( endValue, isRelative, true );
50 _tweenProperties.Add( prop );
51
52 return this;
53 }
54
55
56 /// <summary>
57 /// position path tween
58 /// </summary>
59 public GoTweenConfig positionPath( GoSpline path, bool isRelative = false, GoLookAtType lookAtType = GoLookAtType.None, Transform lookTarget = null )
60 {
61 var prop = new PositionPathTweenProperty( path, isRelative, false, lookAtType, lookTarget );
62 _tweenProperties.Add( prop );
63
64 return this;
65 }
66
67
68 /// <summary>
69 /// uniform scale tween (x, y and z scale to the same value)
70 /// </summary>
71 public GoTweenConfig scale( float endValue, bool isRelative = false )
72 {
73 return this.scale( new Vector3( endValue, endValue, endValue ), isRelative );
74 }
75
76
77 /// <summary>
78 /// scale tween
79 /// </summary>
80 public GoTweenConfig scale( Vector3 endValue, bool isRelative = false )
81 {
82 var prop = new ScaleTweenProperty( endValue, isRelative );
83 _tweenProperties.Add( prop );
84
85 return this;
86 }
87
88
89 /// <summary>
90 /// scale through a series of Vector3s
91 /// </summary>
92 public GoTweenConfig scalePath( GoSpline path, bool isRelative = false )
93 {
94 var prop = new ScalePathTweenProperty( path, isRelative );
95 _tweenProperties.Add( prop );
96
97 return this;
98 }
99
100
101 /// <summary>
102 /// eulerAngle tween
103 /// </summary>
104 public GoTweenConfig eulerAngles( Vector3 endValue, bool isRelative = false )
105 {
106 var prop = new EulerAnglesTweenProperty( endValue, isRelative );
107 _tweenProperties.Add( prop );
108
109 return this;
110 }
111
112
113 /// <summary>
114 /// local eulerAngle tween
115 /// </summary>
116 public GoTweenConfig localEulerAngles( Vector3 endValue, bool isRelative = false )
117 {
118 var prop = new EulerAnglesTweenProperty( endValue, isRelative, true );
119 _tweenProperties.Add( prop );
120
121 return this;
122 }
123
124
125 /// <summary>
126 /// rotation tween
127 /// </summary>
128 public GoTweenConfig rotation( Vector3 endValue, bool isRelative = false )
129 {
130 var prop = new RotationTweenProperty( endValue, isRelative );
131 _tweenProperties.Add( prop );
132
133 return this;
134 }
135
136
137 /// <summary>
138 /// localRotation tween
139 /// </summary>
140 public GoTweenConfig localRotation( Vector3 endValue, bool isRelative = false )
141 {
142 var prop = new RotationTweenProperty( endValue, isRelative, true );
143 _tweenProperties.Add( prop );
144
145 return this;
146 }
147
148
149 /// <summary>
150 /// rotation tween as Quaternion
151 /// </summary>
152 public GoTweenConfig rotation( Quaternion endValue, bool isRelative = false )
153 {
154 var prop = new RotationQuaternionTweenProperty( endValue, isRelative );
155 _tweenProperties.Add( prop );
156
157 return this;
158 }
159
160 /// <summary>
161 /// localRotation tween as Quaternion
162 /// </summary>
163 public GoTweenConfig localRotation( Quaternion endValue, bool isRelative = false )
164 {
165 var prop = new RotationQuaternionTweenProperty( endValue, isRelative, true );
166 _tweenProperties.Add( prop );
167
168 return this;
169 }
170
171
172 /// <summary>
173 /// material color tween
174 /// </summary>
175 public GoTweenConfig materialColor( Color endValue, string colorName = "_Color", bool isRelative = false )
176 {
177 var prop = new MaterialColorTweenProperty( endValue, colorName, isRelative );
178 _tweenProperties.Add( prop );
179
180 return this;
181 }
182
183
184 /// <summary>
185 /// shake tween
186 /// </summary>
187 public GoTweenConfig shake( Vector3 shakeMagnitude, GoShakeType shakeType = GoShakeType.Position, int frameMod = 1, bool useLocalProperties = false )
188 {
189 var prop = new ShakeTweenProperty( shakeMagnitude, shakeType, frameMod, useLocalProperties );
190 _tweenProperties.Add( prop );
191
192 return this;
193 }
194
195
196 #region generic properties
197
198 /// <summary>
199 /// generic vector2 tween
200 /// </summary>
201 public GoTweenConfig vector2Prop( string propertyName, Vector2 endValue, bool isRelative = false )
202 {
203 var prop = new Vector2TweenProperty( propertyName, endValue, isRelative );
204 _tweenProperties.Add( prop );
205
206 return this;
207 }
208
209
210 /// <summary>
211 /// generic vector3 tween
212 /// </summary>
213 public GoTweenConfig vector3Prop( string propertyName, Vector3 endValue, bool isRelative = false )
214 {
215 var prop = new Vector3TweenProperty( propertyName, endValue, isRelative );
216 _tweenProperties.Add( prop );
217
218 return this;
219 }
220
221
222 /// <summary>
223 /// generic vector4 tween
224 /// </summary>
225 public GoTweenConfig vector4Prop( string propertyName, Vector4 endValue, bool isRelative = false )
226 {
227 var prop = new Vector4TweenProperty( propertyName, endValue, isRelative );
228 _tweenProperties.Add( prop );
229
230 return this;
231 }
232
233
234 /// <summary>
235 /// generic vector3 path tween
236 /// </summary>
237 public GoTweenConfig vector3PathProp( string propertyName, GoSpline path, bool isRelative = false )
238 {
239 var prop = new Vector3PathTweenProperty( propertyName, path, isRelative );
240 _tweenProperties.Add( prop );
241
242 return this;
243 }
244
245
246 /// <summary>
247 /// generic vector3.x tween
248 /// </summary>
249 public GoTweenConfig vector3XProp( string propertyName, float endValue, bool isRelative = false )
250 {
251 var prop = new Vector3XTweenProperty( propertyName, endValue, isRelative );
252 _tweenProperties.Add( prop );
253
254 return this;
255 }
256
257
258 /// <summary>
259 /// generic vector3.y tween
260 /// </summary>
261 public GoTweenConfig vector3YProp( string propertyName, float endValue, bool isRelative = false )
262 {
263 var prop = new Vector3YTweenProperty( propertyName, endValue, isRelative );
264 _tweenProperties.Add( prop );
265
266 return this;
267 }
268
269
270 /// <summary>
271 /// generic vector3.z tween
272 /// </summary>
273 public GoTweenConfig vector3ZProp( string propertyName, float endValue, bool isRelative = false )
274 {
275 var prop = new Vector3ZTweenProperty( propertyName, endValue, isRelative );
276 _tweenProperties.Add( prop );
277
278 return this;
279 }
280
281
282 /// <summary>
283 /// generic color tween
284 /// </summary>
285 public GoTweenConfig colorProp( string propertyName, Color endValue, bool isRelative = false )
286 {
287 var prop = new ColorTweenProperty( propertyName, endValue, isRelative );
288 _tweenProperties.Add( prop );
289
290 return this;
291 }
292
293
294 /// <summary>
295 /// generic integer tween
296 /// </summary>
297 public GoTweenConfig intProp( string propertyName, int endValue, bool isRelative = false )
298 {
299 var prop = new IntTweenProperty( propertyName, endValue, isRelative );
300 _tweenProperties.Add( prop );
301
302 return this;
303 }
304
305
306 /// <summary>
307 /// generic float tween
308 /// </summary>
309 public GoTweenConfig floatProp( string propertyName, float endValue, bool isRelative = false )
310 {
311 var prop = new FloatTweenProperty( propertyName, endValue, isRelative );
312 _tweenProperties.Add( prop );
313
314 return this;
315 }
316
317 #endregion
318
319 #endregion
320
321
322 /// <summary>
323 /// adds a TweenProperty to the list
324 /// </summary>
325 public GoTweenConfig addTweenProperty( AbstractTweenProperty tweenProp )
326 {
327 _tweenProperties.Add( tweenProp );
328
329 return this;
330 }
331
332
333 /// <summary>
334 /// clears out all the TweenProperties
335 /// </summary>
336 public GoTweenConfig clearProperties()
337 {
338 _tweenProperties.Clear();
339
340 return this;
341 }
342
343 /// <summary>
344 /// clears out all the TweenProperties
345 /// </summary>
346 public GoTweenConfig clearEvents()
347 {
348 onInitHandler = null;
349 onBeginHandler = null;
350 onIterationStartHandler = null;
351 onUpdateHandler = null;
352 onIterationEndHandler = null;
353 onCompleteHandler = null;
354
355 return this;
356 }
357
358 /// <summary>
359 /// sets the delay for the tween
360 /// </summary>
361 public GoTweenConfig setDelay( float seconds )
362 {
363 delay = seconds;
364
365 return this;
366 }
367
368
369 /// <summary>
370 /// sets the number of iterations. setting to -1 will loop infinitely
371 /// </summary>
372 public GoTweenConfig setIterations( int iterations )
373 {
374 this.iterations = iterations;
375
376 return this;
377 }
378
379
380 /// <summary>
381 /// sets the number of iterations and the loop type. setting to -1 will loop infinitely
382 /// </summary>
383 public GoTweenConfig setIterations( int iterations, GoLoopType loopType )
384 {
385 this.iterations = iterations;
386 this.loopType = loopType;
387
388 return this;
389 }
390
391
392 /// <summary>
393 /// sets the timeScale to be used by the Tween
394 /// </summary>
395 public GoTweenConfig setTimeScale( int timeScale )
396 {
397 this.timeScale = timeScale;
398
399 return this;
400 }
401
402
403 /// <summary>
404 /// sets the ease type for the Tween
405 /// </summary>
406 public GoTweenConfig setEaseType( GoEaseType easeType )
407 {
408 this.easeType = easeType;
409
410 return this;
411 }
412
413
414 /// <summary>
415 /// sets whether the Tween should start paused
416 /// </summary>
417 public GoTweenConfig startPaused()
418 {
419 isPaused = true;
420
421 return this;
422 }
423
424
425 /// <summary>
426 /// sets the update type for the Tween
427 /// </summary>
428 public GoTweenConfig setUpdateType( GoUpdateType setUpdateType )
429 {
430 propertyUpdateType = setUpdateType;
431
432 return this;
433 }
434
435
436 /// <summary>
437 /// sets if this Tween should be a "from" Tween. From Tweens use the current property as the endValue and
438 /// the endValue as the start value
439 /// </summary>
440 public GoTweenConfig setIsFrom()
441 {
442 isFrom = true;
443
444 return this;
445 }
446
447 /// <summary>
448 /// sets if this Tween should be a "to" Tween.
449 /// </summary>
450 public GoTweenConfig setIsTo()
451 {
452 isFrom = false;
453
454 return this;
455 }
456
457
458 /// <summary>
459 /// sets the onInit handler for the Tween
460 /// </summary>
461 public GoTweenConfig onInit( Action<AbstractGoTween> onInit )
462 {
463 onInitHandler = onInit;
464 return this;
465 }
466
467
468 /// <summary>
469 /// sets the onBegin handler for the Tween
470 /// </summary>
471 public GoTweenConfig onBegin( Action<AbstractGoTween> onBegin )
472 {
473 onBeginHandler = onBegin;
474
475 return this;
476 }
477
478
479 /// <summary>
480 /// sets the onIterationStart handler for the Tween
481 /// </summary>
482 public GoTweenConfig onIterationStart( Action<AbstractGoTween> onIterationStart )
483 {
484 onIterationStartHandler = onIterationStart;
485
486 return this;
487 }
488
489
490 /// <summary>
491 /// sets the onUpdate handler for the Tween
492 /// </summary>
493 public GoTweenConfig onUpdate( Action<AbstractGoTween> onUpdate )
494 {
495 onUpdateHandler = onUpdate;
496
497 return this;
498 }
499
500
501 /// <summary>
502 /// sets the onIterationEnd handler for the Tween
503 /// </summary>
504 public GoTweenConfig onIterationEnd( Action<AbstractGoTween> onIterationEnd )
505 {
506 onIterationEndHandler = onIterationEnd;
507
508 return this;
509 }
510
511
512 /// <summary>
513 /// sets the onComplete handler for the Tween
514 /// </summary>
515 public GoTweenConfig onComplete( Action<AbstractGoTween> onComplete )
516 {
517 onCompleteHandler = onComplete;
518
519 return this;
520 }
521
522
523 /// <summary>
524 /// sets the id for the Tween. Multiple Tweens can have the same id and you can retrieve them with the Go class
525 /// </summary>
526 public GoTweenConfig setId( int id )
527 {
528 this.id = id;
529
530 return this;
531 }
532
533 }
2 using System;
3 using System.Collections;
4 using System.Collections.Generic;
5
6
7 public class GoTweenConfig
8 {
9 private List<AbstractTweenProperty> _tweenProperties = new List<AbstractTweenProperty>();
10 public List<AbstractTweenProperty> tweenProperties { get { return _tweenProperties; } }
11
12 public int id; // id for finding the Tween at a later time. multiple Tweens can have the same id
13 public float delay; // how long should we delay before starting the Tween
14 public int iterations = 1; // number of times to iterate. -1 will loop indefinitely
15 public int timeScale = 1;
16 public GoLoopType loopType = Go.defaultLoopType;
17 public GoEaseType easeType = Go.defaultEaseType;
18 public bool isPaused;
19 public GoUpdateType propertyUpdateType = Go.defaultUpdateType;
20 public bool isFrom;
21
22 public Action<AbstractGoTween> onInitHandler;
23 public Action<AbstractGoTween> onBeginHandler;
24 public Action<AbstractGoTween> onIterationStartHandler;
25 public Action<AbstractGoTween> onUpdateHandler;
26 public Action<AbstractGoTween> onIterationEndHandler;
27 public Action<AbstractGoTween> onCompleteHandler;
28
29
30 #region TweenProperty adders
31
32 /// <summary>
33 /// position tween
34 /// </summary>
35 public GoTweenConfig position( Vector3 endValue, bool isRelative = false )
36 {
37 var prop = new PositionTweenProperty( endValue, isRelative );
38 _tweenProperties.Add( prop );
39
40 return this;
41 }
42
43
44 /// <summary>
45 /// localPosition tween
46 /// </summary>
47 public GoTweenConfig localPosition( Vector3 endValue, bool isRelative = false )
48 {
49 var prop = new PositionTweenProperty( endValue, isRelative, true );
50 _tweenProperties.Add( prop );
51
52 return this;
53 }
54
55
56 /// <summary>
57 /// position path tween
58 /// </summary>
59 public GoTweenConfig positionPath( GoSpline path, bool isRelative = false, GoLookAtType lookAtType = GoLookAtType.None, Transform lookTarget = null )
60 {
61 var prop = new PositionPathTweenProperty( path, isRelative, false, lookAtType, lookTarget );
62 _tweenProperties.Add( prop );
63
64 return this;
65 }
66
67
68 /// <summary>
69 /// uniform scale tween (x, y and z scale to the same value)
70 /// </summary>
71 public GoTweenConfig scale( float endValue, bool isRelative = false )
72 {
73 return this.scale( new Vector3( endValue, endValue, endValue ), isRelative );
74 }
75
76
77 /// <summary>
78 /// scale tween
79 /// </summary>
80 public GoTweenConfig scale( Vector3 endValue, bool isRelative = false )
81 {
82 var prop = new ScaleTweenProperty( endValue, isRelative );
83 _tweenProperties.Add( prop );
84
85 return this;
86 }
87
88
89 /// <summary>
90 /// scale through a series of Vector3s
91 /// </summary>
92 public GoTweenConfig scalePath( GoSpline path, bool isRelative = false )
93 {
94 var prop = new ScalePathTweenProperty( path, isRelative );
95 _tweenProperties.Add( prop );
96
97 return this;
98 }
99
100
101 /// <summary>
102 /// eulerAngle tween
103 /// </summary>
104 public GoTweenConfig eulerAngles( Vector3 endValue, bool isRelative = false )
105 {
106 var prop = new EulerAnglesTweenProperty( endValue, isRelative );
107 _tweenProperties.Add( prop );
108
109 return this;
110 }
111
112
113 /// <summary>
114 /// local eulerAngle tween
115 /// </summary>
116 public GoTweenConfig localEulerAngles( Vector3 endValue, bool isRelative = false )
117 {
118 var prop = new EulerAnglesTweenProperty( endValue, isRelative, true );
119 _tweenProperties.Add( prop );
120
121 return this;
122 }
123
124
125 /// <summary>
126 /// rotation tween
127 /// </summary>
128 public GoTweenConfig rotation( Vector3 endValue, bool isRelative = false )
129 {
130 var prop = new RotationTweenProperty( endValue, isRelative );
131 _tweenProperties.Add( prop );
132
133 return this;
134 }
135
136
137 /// <summary>
138 /// localRotation tween
139 /// </summary>
140 public GoTweenConfig localRotation( Vector3 endValue, bool isRelative = false )
141 {
142 var prop = new RotationTweenProperty( endValue, isRelative, true );
143 _tweenProperties.Add( prop );
144
145 return this;
146 }
147
148
149 /// <summary>
150 /// rotation tween as Quaternion
151 /// </summary>
152 public GoTweenConfig rotation( Quaternion endValue, bool isRelative = false )
153 {
154 var prop = new RotationQuaternionTweenProperty( endValue, isRelative );
155 _tweenProperties.Add( prop );
156
157 return this;
158 }
159
160 /// <summary>
161 /// localRotation tween as Quaternion
162 /// </summary>
163 public GoTweenConfig localRotation( Quaternion endValue, bool isRelative = false )
164 {
165 var prop = new RotationQuaternionTweenProperty( endValue, isRelative, true );
166 _tweenProperties.Add( prop );
167
168 return this;
169 }
170
171
172 /// <summary>
173 /// material color tween
174 /// </summary>
175 public GoTweenConfig materialColor( Color endValue, string colorName = "_Color", bool isRelative = false )
176 {
177 var prop = new MaterialColorTweenProperty( endValue, colorName, isRelative );
178 _tweenProperties.Add( prop );
179
180 return this;
181 }
182
183
184 /// <summary>
185 /// shake tween
186 /// </summary>
187 public GoTweenConfig shake( Vector3 shakeMagnitude, GoShakeType shakeType = GoShakeType.Position, int frameMod = 1, bool useLocalProperties = false )
188 {
189 var prop = new ShakeTweenProperty( shakeMagnitude, shakeType, frameMod, useLocalProperties );
190 _tweenProperties.Add( prop );
191
192 return this;
193 }
194
195
196 #region generic properties
197
198 /// <summary>
199 /// generic vector2 tween
200 /// </summary>
201 public GoTweenConfig vector2Prop( string propertyName, Vector2 endValue, bool isRelative = false )
202 {
203 var prop = new Vector2TweenProperty( propertyName, endValue, isRelative );
204 _tweenProperties.Add( prop );
205
206 return this;
207 }
208
209
210 /// <summary>
211 /// generic vector3 tween
212 /// </summary>
213 public GoTweenConfig vector3Prop( string propertyName, Vector3 endValue, bool isRelative = false )
214 {
215 var prop = new Vector3TweenProperty( propertyName, endValue, isRelative );
216 _tweenProperties.Add( prop );
217
218 return this;
219 }
220
221
222 /// <summary>
223 /// generic vector4 tween
224 /// </summary>
225 public GoTweenConfig vector4Prop( string propertyName, Vector4 endValue, bool isRelative = false )
226 {
227 var prop = new Vector4TweenProperty( propertyName, endValue, isRelative );
228 _tweenProperties.Add( prop );
229
230 return this;
231 }
232
233
234 /// <summary>
235 /// generic vector3 path tween
236 /// </summary>
237 public GoTweenConfig vector3PathProp( string propertyName, GoSpline path, bool isRelative = false )
238 {
239 var prop = new Vector3PathTweenProperty( propertyName, path, isRelative );
240 _tweenProperties.Add( prop );
241
242 return this;
243 }
244
245
246 /// <summary>
247 /// generic vector3.x tween
248 /// </summary>
249 public GoTweenConfig vector3XProp( string propertyName, float endValue, bool isRelative = false )
250 {
251 var prop = new Vector3XTweenProperty( propertyName, endValue, isRelative );
252 _tweenProperties.Add( prop );
253
254 return this;
255 }
256
257
258 /// <summary>
259 /// generic vector3.y tween
260 /// </summary>
261 public GoTweenConfig vector3YProp( string propertyName, float endValue, bool isRelative = false )
262 {
263 var prop = new Vector3YTweenProperty( propertyName, endValue, isRelative );
264 _tweenProperties.Add( prop );
265
266 return this;
267 }
268
269
270 /// <summary>
271 /// generic vector3.z tween
272 /// </summary>
273 public GoTweenConfig vector3ZProp( string propertyName, float endValue, bool isRelative = false )
274 {
275 var prop = new Vector3ZTweenProperty( propertyName, endValue, isRelative );
276 _tweenProperties.Add( prop );
277
278 return this;
279 }
280
281
282 /// <summary>
283 /// generic color tween
284 /// </summary>
285 public GoTweenConfig colorProp( string propertyName, Color endValue, bool isRelative = false )
286 {
287 var prop = new ColorTweenProperty( propertyName, endValue, isRelative );
288 _tweenProperties.Add( prop );
289
290 return this;
291 }
292
293
294 /// <summary>
295 /// generic integer tween
296 /// </summary>
297 public GoTweenConfig intProp( string propertyName, int endValue, bool isRelative = false )
298 {
299 var prop = new IntTweenProperty( propertyName, endValue, isRelative );
300 _tweenProperties.Add( prop );
301
302 return this;
303 }
304
305
306 /// <summary>
307 /// generic float tween
308 /// </summary>
309 public GoTweenConfig floatProp( string propertyName, float endValue, bool isRelative = false )
310 {
311 var prop = new FloatTweenProperty( propertyName, endValue, isRelative );
312 _tweenProperties.Add( prop );
313
314 return this;
315 }
316
317 #endregion
318
319 #endregion
320
321
322 /// <summary>
323 /// adds a TweenProperty to the list
324 /// </summary>
325 public GoTweenConfig addTweenProperty( AbstractTweenProperty tweenProp )
326 {
327 _tweenProperties.Add( tweenProp );
328
329 return this;
330 }
331
332
333 /// <summary>
334 /// clears out all the TweenProperties
335 /// </summary>
336 public GoTweenConfig clearProperties()
337 {
338 _tweenProperties.Clear();
339
340 return this;
341 }
342
343 /// <summary>
344 /// clears out all the TweenProperties
345 /// </summary>
346 public GoTweenConfig clearEvents()
347 {
348 onInitHandler = null;
349 onBeginHandler = null;
350 onIterationStartHandler = null;
351 onUpdateHandler = null;
352 onIterationEndHandler = null;
353 onCompleteHandler = null;
354
355 return this;
356 }
357
358 /// <summary>
359 /// sets the delay for the tween
360 /// </summary>
361 public GoTweenConfig setDelay( float seconds )
362 {
363 delay = seconds;
364
365 return this;
366 }
367
368
369 /// <summary>
370 /// sets the number of iterations. setting to -1 will loop infinitely
371 /// </summary>
372 public GoTweenConfig setIterations( int iterations )
373 {
374 this.iterations = iterations;
375
376 return this;
377 }
378
379
380 /// <summary>
381 /// sets the number of iterations and the loop type. setting to -1 will loop infinitely
382 /// </summary>
383 public GoTweenConfig setIterations( int iterations, GoLoopType loopType )
384 {
385 this.iterations = iterations;
386 this.loopType = loopType;
387
388 return this;
389 }
390
391
392 /// <summary>
393 /// sets the timeScale to be used by the Tween
394 /// </summary>
395 public GoTweenConfig setTimeScale( int timeScale )
396 {
397 this.timeScale = timeScale;
398
399 return this;
400 }
401
402
403 /// <summary>
404 /// sets the ease type for the Tween
405 /// </summary>
406 public GoTweenConfig setEaseType( GoEaseType easeType )
407 {
408 this.easeType = easeType;
409
410 return this;
411 }
412
413
414 /// <summary>
415 /// sets whether the Tween should start paused
416 /// </summary>
417 public GoTweenConfig startPaused()
418 {
419 isPaused = true;
420
421 return this;
422 }
423
424
425 /// <summary>
426 /// sets the update type for the Tween
427 /// </summary>
428 public GoTweenConfig setUpdateType( GoUpdateType setUpdateType )
429 {
430 propertyUpdateType = setUpdateType;
431
432 return this;
433 }
434
435
436 /// <summary>
437 /// sets if this Tween should be a "from" Tween. From Tweens use the current property as the endValue and
438 /// the endValue as the start value
439 /// </summary>
440 public GoTweenConfig setIsFrom()
441 {
442 isFrom = true;
443
444 return this;
445 }
446
447 /// <summary>
448 /// sets if this Tween should be a "to" Tween.
449 /// </summary>
450 public GoTweenConfig setIsTo()
451 {
452 isFrom = false;
453
454 return this;
455 }
456
457
458 /// <summary>
459 /// sets the onInit handler for the Tween
460 /// </summary>
461 public GoTweenConfig onInit( Action<AbstractGoTween> onInit )
462 {
463 onInitHandler = onInit;
464 return this;
465 }
466
467
468 /// <summary>
469 /// sets the onBegin handler for the Tween
470 /// </summary>
471 public GoTweenConfig onBegin( Action<AbstractGoTween> onBegin )
472 {
473 onBeginHandler = onBegin;
474
475 return this;
476 }
477
478
479 /// <summary>
480 /// sets the onIterationStart handler for the Tween
481 /// </summary>
482 public GoTweenConfig onIterationStart( Action<AbstractGoTween> onIterationStart )
483 {
484 onIterationStartHandler = onIterationStart;
485
486 return this;
487 }
488
489
490 /// <summary>
491 /// sets the onUpdate handler for the Tween
492 /// </summary>
493 public GoTweenConfig onUpdate( Action<AbstractGoTween> onUpdate )
494 {
495 onUpdateHandler = onUpdate;
496
497 return this;
498 }
499
500
501 /// <summary>
502 /// sets the onIterationEnd handler for the Tween
503 /// </summary>
504 public GoTweenConfig onIterationEnd( Action<AbstractGoTween> onIterationEnd )
505 {
506 onIterationEndHandler = onIterationEnd;
507
508 return this;
509 }
510
511
512 /// <summary>
513 /// sets the onComplete handler for the Tween
514 /// </summary>
515 public GoTweenConfig onComplete( Action<AbstractGoTween> onComplete )
516 {
517 onCompleteHandler = onComplete;
518
519 return this;
520 }
521
522
523 /// <summary>
524 /// sets the id for the Tween. Multiple Tweens can have the same id and you can retrieve them with the Go class
525 /// </summary>
526 public GoTweenConfig setId( int id )
527 {
528 this.id = id;
529
530 return this;
531 }
532
533 }